package gold.digger;

import gold.utils.InputUtil;

/**
 * Created by fanzhenyu02 on 2021/12/10.
 * common problem solver template.
 */
public class LC1184 {
    public long startExecuteTime = System.currentTimeMillis();


    class Solution {
        public int distanceBetweenBusStops(int[] distance, int start, int destination) {
            if (start > destination) {
                int temp = start;
                start = destination;
                destination = temp;
            }
            int sum1 = 0, sum2 = 0;
            for (int i = 0; i < distance.length; i++) {
                if (i >= start && i < destination) {
                    sum1 += distance[i];
                } else {
                    sum2 += distance[i];
                }
            }
            return Math.min(sum1, sum2);
        }
    }


    public void run() {
        int[] arr = InputUtil.toIntegerArray("[1,2,3]");
        System.out.println(new Solution().toString());
    }

    public static void main(String[] args) throws Exception {
        LC1184 an = new LC1184();
        an.run();

        System.out.println("\ncurrent solution total execute time: " + (System.currentTimeMillis() - an.startExecuteTime) + " ms.");
    }
}
